<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>药店管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="/layui/css/layui.css" rel="stylesheet">
    <script src="/jquery/jquery-3.6.0.js"></script>
</head>

<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo layui-hide-xs layui-bg-black">小药店管理系统</div>
        <!-- 头部区域（可配合layui 已有的水平导航） -->
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-sm-inline-block">
                <a>
                    <img src="//unpkg.com/outeres@0.0.10/img/layui/icon-v2.png" class="layui-nav-img">
                    欢迎, <span id="username">管理员</span>
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="javascript:;" onclick="logout()">退出</a></dd>
                </dl>
            </li>
        </ul>
    </div>
    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">采购管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="supplier/supplier.html">供应商信息管理</a></dd>
                        <dd><a href="supplier/drug.html">药品信息管理</a></dd>
                        <dd><a href="procurement/add.html">采购单添加</a></dd>
                        <dd><a href="procurement/list.html">采购单管理</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">销售管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="sales/add_xiaoshoudan.html">销售单添加</a></dd>
                        <dd><a href="sales/xiaoshoumingxi.html">销售单管理</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">药店统计管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="statistics/instock.html">入库统计</a></dd>
                        <dd><a href="statistics/sales.html">销售统计</a></dd>
                        <dd><a href="statistics/stock.html">库存查询</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">人事管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="yuangong/add_yuangong.html">员工添加</a></dd>
                        <dd><a href="yuangong/yuangong.html">员工管理</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">打印管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="/print/ruku.html">入库单</a></dd>
                        <dd><a href="/print/chuku.html">出库单</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">系统管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="user/xiuGaiMiMa.html">修改密码</a></dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>
    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding: 20px;">
            <!-- 欢迎信息 -->
            <div class="layui-card" style="margin-bottom: 20px;">
                <div class="layui-card-body" style="text-align: center; padding: 30px; background: linear-gradient(to right, #1E9FFF, #5FB878);">
                    <h2 style="color: white; font-size: 24px; margin-bottom: 10px;">欢迎来到小药店管理系统！</h2>
                    <p style="color: rgba(255,255,255,0.9); font-size: 16px;">这里是您管理药店日常运营的中心平台</p>
                </div>
            </div>

            <div class="layui-card">
                <div class="layui-card-header" style="font-size: 18px; font-weight: bold;">
                    <i class="layui-icon layui-icon-home"></i> 系统概览
                </div>
                <div class="layui-card-body">
                    <!-- 统计卡片 -->
                    <div class="layui-row layui-col-space15">
                        <div class="layui-col-md3">
                            <div class="layui-card" style="background-color: #FFB800;">
                                <div class="layui-card-body" style="color: white;">
                                    <h3>今日销售额</h3>
                                    <h2>¥<span id="todaySales">554216</span></h2>
                                    <p>较昨日 <span id="salesGrowth">16%</span></p>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md3">
                            <div class="layui-card" style="background-color: #5FB878;">
                                <div class="layui-card-body" style="color: white;">
                                    <h3>库存预警</h3>
                                    <h2><span id="lowStock">82</span>件</h2>
                                    <p>需要补货的商品数量</p>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md3">
                            <div class="layui-card" style="background-color: #1E9FFF;">
                                <div class="layui-card-body" style="color: white;">
                                    <h3>本月订单数</h3>
                                    <h2><span id="monthOrders">126625</span>单</h2>
                                    <p>较上月 <span id="orderGrowth">5%</span></p>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md3">
                            <div class="layui-card" style="background-color: #FF5722;">
                                <div class="layui-card-body" style="color: white;">
                                    <h3>近效期商品</h3>
                                    <h2><span id="expiringProducts">139</span>种</h2>
                                    <p>30天内过期</p>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- 快捷操作区 -->
                    <div class="layui-card" style="margin-top: 20px;">
                        <div class="layui-card-header">快捷操作</div>
                        <div class="layui-card-body">
                            <div class="layui-btn-container">
                                <button class="layui-btn layui-btn-normal" onclick="window.location.href='/sales/add_xiaoshoudan.html'">
                                    <i class="layui-icon layui-icon-cart"></i> 新增销售单
                                </button>
                                <button class="layui-btn layui-btn-warm" onclick="window.location.href='/statistics/stock.html'">
                                    <i class="layui-icon layui-icon-form"></i> 库存盘点
                                </button>
                                <button class="layui-btn layui-btn-danger" onclick="window.location.href='/procurement/add.html'">
                                    <i class="layui-icon layui-icon-cart-simple"></i> 采购申请
                                </button>
                                <button class="layui-btn" onclick="window.location.href='/statistics/sales.html'">
                                    <i class="layui-icon layui-icon-chart"></i> 查看报表
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>

<script src="/layui/layui.js"></script>
<script>
    function logout() {
        $.ajax({
            url: '/user/logout',
            type: 'GET',
            success: function(res) {
                if(res.code === 0) {
                    window.location.href = '/login/login.html';
                } else {
                    layer.msg(res.msg || '退出失败', {icon: 2});
                }
            },
            error: function() {
                layer.msg('服务器错误', {icon: 2});
            }
        });
    }

    layui.use(['layer'], function(){
        var layer = layui.layer;
        
        // 绑定修改密码点击事件
        $('#changePwdBtn').on('click', function(){
            layer.open({
                type: 2,
                title: '修改密码',
                shade: 0.6,
                area: ['500px', '400px'],
                content: '/xiugaimima.html',
                resize: false
            });
        });
    });
</script>
</html>